home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
BCI NET
/
BCI NET Dec 94.iso
/
archives
/
sound
/
players
/
midiplay221a.lha
/
MidiPlay
/
ARexx
/
D10Display.rexx
next >
Wrap
OS/2 REXX Batch file
|
1994-09-18
|
1KB
|
76 lines
/* This is an example ARexx script for use with MidiPlay.
Use the following parameter: FILENAMEREXX=ThisScript.rexx
When MidiPlay has loaded a new file, it calls ThisScript.
Argument consists of drive, path, file and extension of the filename.
This particular example shows the name of the file on the lcd display of
Roland D10. Modify it to work on your setup.
*/
options results
parse arg Drive ',' Path ',' File ',' Extension .
ManuID = 41
DevID = 10
ModelID = 16
CmdID = 12
RolandAddress = 20 0 0
/* This values can be used with GM modules which recognize SC55 parameters
ModelID = 45
RolandAddress = 10 0 0 0 0
*/
address 'MidiPlay_rexx'
DataStr = RolandAddress TextToHex(File)
Checksum = d2c(128-CalcChecksum(DataStr))
'sysex' ManuID DevID ModelID CmdID DataStr c2x(Checksum)
exit
/* This function converts a text argument to a hexadecimal string */
TextToHex:
parse arg Str
i = 0
HexStr = ""
do while Str ~= ""
parse var Str first +1 Str2
r1 = c2x(first)
if (c2d(first) < 128) then do
HexStr = HexStr r1
i = i + 1
end
Str = Str2
if i > 32 then break /* Roland can only display 32 characters */
end
return HexStr
/* This function calculates the checksum of a hexadecimal string */
CalcChecksum:
parse arg DStr
val = 0
do while DStr ~= ""
parse var DStr M1 M2
r1 = c2d(x2c(M1))
val = c2d(bitand(d2c(val + r1),'7f'x))
DStr = M2
end
return val